package org.alanlau.annotation;

import org.alanlau.instance.BeanClass;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 基于注解的装配方式
 *
 * @author alan
 * @version 1.0
 * @date 2020/1/12 9:37
 */
@Component
public class AnnotationUser {
    @Resource(name = "constructorInstance")
    private BeanClass beanClass;

    @Resource(name = "constructorInstance2")
    private BeanClass beanClass2;

    @Value("alanlau")
    private String userName;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getBeanMessage() {
        return beanClass.message;
    }

    public String getBean2Message() {
        return beanClass2.message;
    }
}
